package com.inspur.edp.bff.spi.assembler;

import com.inspur.edp.bff.api.manager.IFSManagerContext;
import com.inspur.edp.bff.api.manager.assembler.IExtendDeleteChildAssembler;
import com.inspur.edp.bff.api.manager.context.DeleteChildContext;
import com.inspur.edp.bff.spi.action.delete.AbstractDeleteChildAction;

import java.util.ArrayList;

public abstract class AbstractExtendDeleteChildAssembler implements IExtendDeleteChildAssembler {


    protected ArrayList<AbstractDeleteChildAction> getDeleteActions(DeleteChildContext delContext) {
        return null;
    }

    public final void doDelete(IFSManagerContext context, DeleteChildContext delContext) {
        ArrayList<AbstractDeleteChildAction> actions = getDeleteActions(delContext);
        if (actions == null || actions.isEmpty()) {
            return;
        }

        for (AbstractDeleteChildAction action : actions) {
            action.deal(context);
        }
    }
}
